<template>
	<view class="page-wrapper">
		<image src="../../../../static/img/public/order-detail-bg.png" class="bg" mode="widthFix" ></image>
		<image src="../../../../static/img/public/order-detail-bg2.png" class="bg2" mode="widthFix"></image>
		<div class="title" :style="'height:' + navH +'px'" >
			<div @click="goBack" class="title-l">
				<image src="../../../../static/img/public/left.png" mode="widthFix"></image>
			</div>
			<div class="title-c">
				订单详情
			</div>
		</div>
		<div class="content">
			<div class="status">
				<span>
					{{info.status === 0 ? '未付款' : info.status === 1 ? '已付款' : info.status === 3 ? '待评价' : info.status === 4 ? '已完成' : ''}}
				</span>
			</div>
			<div class="content-t">
				<image src="../../../../static/img/public/order-detail-position.png" mode="widthFix"></image>
				<div>
					<span>
						<h3>{{info.address_name || '张三'}}</h3>
						<p>{{info.address_name || '18999999999'}}</p>
					</span>
					<p>{{info.address_province + info.address_city + info.address_district + info.address_street}}</p>
				</div>
			</div>
			<div class="content-c">
				<h3>产品信息</h3>
				<div>
					<span>产品：</span>
					<p>{{info.goods_title}}</p>
				</div>
				<div>
					<span>订单号：</span>
					<p>{{info.order_sn}}</p>
				</div>
				<div v-if="info.status !== 0">
					<span>支付号：</span>
					<p>{{info.pay_sn}}</p>
				</div>
				<div>
					<span>价格：</span>
					<p class="price">￥{{info.trade_fee}}</p>
				</div>
			</div>
		</div>
		
	</view>
</template>

<script>
	import {api} from '@/util/api.js';
	
	export default {
		data() {
			return {
				navH: null,
				sn: null,
				info: null
			}
		},
		methods: {
			getData() {
				api.getOrderDetail({
					order_sn: this.sn
				}, res => {
					this.info = res.data;
				})
			},
			goBack() {
				uni.navigateBack();
			},
			goDetail() {
				
			}
		},
		onLoad(option) {
			this.sn = option.sn;
			let app = getApp();
			this.navH = app.globalData.navHeight;
			
			this.getData();
		}
	}
</script>

<style>
	.page-wrapper {
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
	}
	.page-wrapper>.bg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		z-index: -1;
	}
	.page-wrapper>.bg2 {
		position: absolute;
		top: 130rpx;
		right: 90rpx;
		width: 150rpx;
		z-index: -1;
	}
	
	.title {
		display: flex;
		align-items: flex-end;
		width: 100%;
		flex-shrink: 0;
		box-sizing: border-box;
		padding: 0 20rpx;
	}
	.title>.title-l {
		width: 19rpx;
		height: 66rpx;
		flex-shrink: 0;
		display: flex;
		align-items: center;
	}
	.title>.title-l>image {
		width: 100%;
		vertical-align: middle;
	}
	.title-c {
		flex-grow: 1;
		height: 66rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		vertical-align: middle;
		color: #ffffff;
		font-size: 34rpx;
	}
	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
		padding: 30rpx;
	}
	.content>.status {
		width: 100%;
		height: 100rpx;
		box-sizing: border-box;
		padding-left: 40rpx;
		display: flex;
		align-items: flex-end;
		justify-content: flex-start;
		color:  #ffffff;
		font-size: 43rpx;
	}
	.content-t {
		background-color: #ffffff;
		box-sizing: border-box;
		padding: 40rpx 20rpx;
		width: 100%;
		border-radius: 14rpx;
		margin-top: 40rpx;
		display: flex;
		align-items: center;
	}
	
	.content-t>image {
		width: 98rpx;
		flex-shrink: 0;
	}
	.content-t>div {
		flex-grow: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		margin-left: 20rpx;
		color: #666666;
	}
	.content-t>div>span {
		display: flex;
		align-items: center;
		margin-bottom: 10rpx
	}
	.content-t>div>span>h3 {
		font-size: 40rpx;
		color: #333333;
		margin-right: 10rpx
	}
	.content-t>div>span>p {
		font-size: 32rpx;
	}
	.content-t>div>p {
		display: flex;
		align-items: center;
		font-size: 35rpx;
	}
	.content-c {
		background-color: #ffffff;
		box-sizing: border-box;
		padding: 40rpx 20rpx;
		width: 100%;
		border-radius: 14rpx;
		margin-top: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		
	}
	.content-c>h3 {
		width: 100%;
		font-size: 40rpx;
		color: #333333;
		box-sizing: border-box;
		padding-bottom: 40rpx;
		border-bottom: 2rpx solid #eeeeee
	}
	.content-c>div {
		width: 100%;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 20rpx 0;
	}
	.content-c>div>span {
		flex-shrink: 0;
		color: #666666;
		font-size: 35rpx;
	}
	.content-c>div>p {
		flex-grow: 1;
		text-align: right;
		color: #666666;
		font-size: 35rpx;
		word-break: break-all;
	}
	.content-c>div>p.price {
		color: #ff4040;
		font-size: 33rpx;
	}
	
	
</style>
